from functools import partial
from pywebio_battery import popup_input
from pywebio import start_server
from pywebio.input import *
from pywebio.output import *
from pywebio.pin import *
from pywebio.session import hold
import pendulum
import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Graph
import toml
from pathlib import Path
import random
import socket

CONFIGFILENAME = '/root/smartai/configure/config.toml'
DATAPATH = '/root/smartai/data'

hostname = socket.gethostname()
scope_output = 'text_output'

def menu_user_edit():
    put_text('开始编辑用户')

def menu_sync():
    put_text('开始同步')
       
def main():
    put_tabs([{
        'title':
        '目标识别',
        'content': [
            put_row(put_input('edit_name', label='姓名')),
            put_row(put_button('search', outline=True, onclick=menu_user_edit))
        ]
    },
    {
        'title':
        '人脸识别',
        'content': [
            put_row(
                put_buttons([
                    '人物检查', '无电话', '孤立人物', '无调度', '标识匹配', '属性同步', '同步用户库电话',
                    '同步用户库拼音'
                ],
                            onclick=menu_sync))
        ]
    }])

    use_scope(scope_output)
    hold()

# http://localhost:8604
start_server(main, port=8604, debug=True, cdn=False, static_dir="/root/data/")
